package com.hzw.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Book {
    private static final Long seralVersionUD=-22178712782L;
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    private String name;
    private Double price;
    private String description;
    private String type;
    private Date createTime;
    private Long parentId;
    @TableField(exist = false)
    private Author author;
    @TableField(exist = false)
    private List<Fans> fans;

    public Book(Long id, String name, Double price, String description, String type, Date createTime, Long parentId) {
        this.id = id;
        this.name = name;
        this.price = price;
        this.description = description;
        this.type = type;
        this.createTime = createTime;
        this.parentId = parentId;
    }

    public Book(Long id, String name, Double price, String description, Date createTime) {
        this.id = id;
        this.name = name;
        this.price = price;
        this.description = description;
        this.createTime = createTime;
    }

    public Book(Long id, String name, Double price, String description, Date createTime, Author author) {
        this.id = id;
        this.name = name;
        this.price = price;
        this.description = description;
        this.createTime = createTime;
        this.author = author;
    }

    public Book(Long id, String name, Double price, String description, Date createTime, List<Fans> fans) {
        this.id = id;
        this.name = name;
        this.price = price;
        this.description = description;
        this.createTime = createTime;
        this.fans = fans;
    }
}
